package demo.propertySupport;

import java.beans.PropertyVetoException;

/**
 * description: <br>
 * createTime: 2021/1/13 17:42 <br>
 *
 * @author zzh
 */
public class Test2 {

    public static void main(String[] args) {
        SomeBean someBean = new SomeBean();
        someBean.addPropertyChangeListener(new SomeBeanPropertyListener());
        someBean.addVetoableChangeListener(new SomeBeanPropertyListener());
        try {
            someBean.setChangableValue("someValue");
            someBean.setChangableValue("anotherValue");
            someBean.setChangableValue("invalidValue");
        } catch (PropertyVetoException e) {
            System.err.println(e.getMessage());
        }
        System.out.println(someBean.getChangableValue());
    }
}
